r = [{'faceId': 'd6c103e8-44f9-42ee-b83d-fc5250eba536',
  'faceRectangle': {'top': 93, 'left': 594, 'width': 144, 'height': 144},
  'faceAttributes': {'smile': 0.735,
   'gender': 'female',
   'age': 22.0,
   'glasses': 'NoGlasses',
   'hair': {'bald': 0.07,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 1.0},
     {'color': 'brown', 'confidence': 0.74},
     {'color': 'other', 'confidence': 0.53},
     {'color': 'gray', 'confidence': 0.21},
     {'color': 'blond', 'confidence': 0.04},
     {'color': 'red', 'confidence': 0.04},
     {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': '6183ec3b-94c2-455e-b53a-1ca9071391a9',
  'faceRectangle': {'top': 98, 'left': 422, 'width': 135, 'height': 135},
  'faceAttributes': {'smile': 0.999,
   'gender': 'female',
   'age': 24.0,
   'glasses': 'NoGlasses',
   'hair': {'bald': 0.2,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 1.0},
     {'color': 'brown', 'confidence': 0.86},
     {'color': 'gray', 'confidence': 0.4},
     {'color': 'other', 'confidence': 0.38},
     {'color': 'blond', 'confidence': 0.05},
     {'color': 'red', 'confidence': 0.03},
     {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': 'b7a7b38c-ece8-4b6c-a8ec-be84887596da',
  'faceRectangle': {'top': 87, 'left': 288, 'width': 135, 'height': 135},
  'faceAttributes': {'smile': 0.998,
   'gender': 'female',
   'age': 23.0,
   'glasses': 'NoGlasses',
   'hair': {'bald': 0.04,
    'invisible': False,
    'hairColor': [{'color': 'brown', 'confidence': 1.0},
     {'color': 'red', 'confidence': 0.54},
     {'color': 'black', 'confidence': 0.34},
     {'color': 'blond', 'confidence': 0.31},
     {'color': 'gray', 'confidence': 0.06},
     {'color': 'other', 'confidence': 0.03},
     {'color': 'white', 'confidence': 0.0}]}}}]
# 创建字典
gender = {}
age = {}
glasses = {}
haircolor = {}
smile = {}
count = 0
while count < len(r):
    glasses["Person{}".format(count + 1)] = r[count]['faceAttributes']['glasses']
    smile["Person{}".format(count + 1)] = r[count]['faceAttributes']['smile']
    haircolor["Person{}".format(count + 1)] = r[count]['faceAttributes']['hair']['hairColor'][0]['color']
    age["Person{}".format(count + 1)] = r[count]['faceAttributes']['age']
    gender["Person{}".format(count + 1)] = r[count]['faceAttributes']['gender']
    count += 1
    
# 打印字典    
print("glasses：", glasses)
print("smile：", smile)
print("haircolor：", haircolor)
print("age：", age)
print("gender：", gender)

# 响应结果
# glasses： {'Person1': 'NoGlasses', 'Person2': 'NoGlasses', 'Person3': 'NoGlasses'}
# smile： {'Person1': 0.735, 'Person2': 0.999, 'Person3': 0.998}
# haircolor： {'Person1': 'black', 'Person2': 'black', 'Person3': 'brown'}
# age： {'Person1': 22.0, 'Person2': 24.0, 'Person3': 23.0}
# gender： {'Person1': 'female', 'Person2': 'female', 'Person3': 'female'}

